unit uOleForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtnrs, ExtCtrls;

type
  TOleForm = class(TForm)
    OleContainer1: TOleContainer;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
    FileName: string;
  end;

implementation

{$R *.dfm}

procedure TOleForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Free;
end;

procedure TOleForm.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  Caption := ExtractFileName(FileName);
  OleContainer1.CreateObjectFromFile(FileName, False);
  OleContainer1.DoVerb(0);
end;

end.
